package com.wing.department.controller;


import com.wing.common.utils.JsonResult;
import com.wing.department.service.DepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 畅捷通-仓库管理2
 *
 * @author xiayang
 */
@Validated
@Api(value = "畅捷通-部门管理", tags = "#/chanjet/department")
@RestController("DepartmentController")
@RequestMapping("department/admin/department")
@RequiredArgsConstructor
public class DepartmentController {

    @Resource
    DepartmentService departmentService;

    /**
     * 部门查询
     */
    @ApiOperation(value = "查询所有", notes = "搜索")
    @PostMapping("/query")
    public JsonResult<List<Map<String, Object>>> query() {
        return JsonResult.success(departmentService.getDepartmentList());
    }


    @ApiOperation(value = "创建部门", notes = "新增")
    @PostMapping("/createDepartment")
    public JsonResult createDepartment() {
       return departmentService.createDepartment();
    }

}
